<template>
  <el-collapse
    v-model="activeNames"
    @change="handleChange"
    class="panelCollapse"
  >
    <el-collapse-item title="今日指标" name="1">
      <el-row
        :gutter="40"
        class="panel-group"
        style="margin-left: 0; margin-right: 0"
      >
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="zhuce" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日注册用户数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.registerCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日充值笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.chargeCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="USDTqukuailian"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日充值USDT</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.chargeUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日提现笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.withdrawCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="tixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日提现USDT</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.withdrawUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日XCH订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.xchOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日XCH订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.xchOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日CRU订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.cruOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日CRU订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.cruOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日BZZ订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.bzzOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日BZZ订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.bzzOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日PHA订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.phaOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">今日PHA订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.todayIndicator.phaOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
      </el-row>
    </el-collapse-item>
    <el-collapse-item title="汇总指标" name="2">
      <el-row
        :gutter="40"
        class="panel-group"
        style="margin-left: 0; margin-right: 0"
      >
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="zhuce" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总注册用户数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.registerCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总充值笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.chargeCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="USDTqukuailian"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总充值USDT</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.chargeUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总提现笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.withdrawCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="tixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总提现USDT</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.withdrawUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总XCH订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.xchOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总XCH订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.xchOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总CRU订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.cruOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总CRU订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.cruOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总BZZ订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.bzzOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总BZZ订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.bzzOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon
                icon-class="chongzhibishu"
                class-name="card-panel-icon"
              />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总PHA订单笔数</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.phaOrderCount)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>

        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="dingdanjine" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">总PHA订单金额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.phaOrderUSDT)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
      </el-row>
    </el-collapse-item>
    <el-collapse-item title="通用指标" name="3">
      <el-row
        :gutter="40"
        class="panel-group"
        style="margin-left: 0; margin-right: 0"
      >
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现BTC余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.btcBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现CRU余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.cruBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现BZZ余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.bzzBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现XCH余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.xchBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现PHA余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.phaBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
          <div class="card-panel">
            <div class="card-panel-icon-wrapper icon-shopping">
              <svg-icon icon-class="weitixian" class-name="card-panel-icon" />
            </div>
            <div class="card-panel-description">
              <div class="card-panel-text">未提现USDT余额</div>
              <count-to
                :start-val="0"
                :end-val="Number(resultParams.totalIndicator.usdtBalance)"
                :duration="2000"
                class="card-panel-num"
              />
            </div>
          </div>
        </el-col>
      </el-row>
    </el-collapse-item>
  </el-collapse>
</template>

<script>
import CountTo from 'vue-count-to'
import { monitor } from "@/api/biz";


export default {
  components: {
    CountTo
  },
  data () {
    return {
      activeNames: ['1', '2', '3'],
      resultParams: {
        todayIndicator: {
          registerCount: 0,
          chargeCount: 0,
          chargeUSDT: 0,
          withdrawCount: 0,
          withdrawUSDT: 0,
          xchOrderCount: 0,
          xchOrderUSDT: 0,
          cruOrderCount: 0,
          cruOrderUSDT: 0,
          bzzOrderCount: 0,
          bzzOrderUSDT: 0,
          phaOrderCount: 0,
          phaOrderUSDT: 0
        },   //今日指标
        totalIndicator: {
          registerCount: 0,
          chargeCount: 0,
          chargeUSDT: 0,
          withdrawCount: 0,
          withdrawUSDT: 0,
          xchOrderCount: 0,
          xchOrderUSDT: 0,
          cruOrderCount: 0,
          cruOrderUSDT: 0,
          bzzOrderCount: 0,
          bzzOrderUSDT: 0,
          phaOrderCount: 0,
          phaOrderUSDT: 0,
          btcBalance: 0,
          cruBalance: 0,
          bzzBalance: 0,
          xchBalance: 0,
          phaBalance: 0,
          usdtBalance: 0
        }    //总指标
      }
    }
  },
  created () {
    this.selfMonitor()
  },
  methods: {
    handleChange (val) {
      console.log(val);
    },
    selfMonitor () {
      monitor().then(response => {
        this.resultParams.todayIndicator = Object.assign({}, response.todayIndicator)
        this.resultParams.totalIndicator = Object.assign({}, response.totalIndicator)
      });
    },
    handleSetLineChartData (type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style lang="scss">
.panelCollapse {
  .el-collapse-item__header {
    padding-left: 20px;
    font-size: 18px;
  }
  .el-collapse-item__header {
    height: 40px;
    line-height: 40px;
  }
  .el-collapse-item__content {
    padding-bottom: 10px;
  }
  .panel-group {
    margin-top: 10px;

    .card-panel-col {
      margin-bottom: 20px;
    }

    .card-panel {
      height: 108px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
      border-color: rgba(0, 0, 0, 0.05);

      //&:hover {
      //  .card-panel-icon-wrapper {
      //    color: #fff;
      //  }
      //
      //  .icon-people {
      //    background: #40c9c6;
      //  }
      //
      //  .icon-message {
      //    background: #36a3f7;
      //  }
      //
      //  .icon-money {
      //    background: #f4516c;
      //  }
      //
      //  .icon-shopping {
      //    background: #34bfa3
      //  }
      //}

      .icon-people {
        color: #40c9c6;
      }

      .icon-message {
        color: #36a3f7;
      }

      .icon-money {
        color: #f4516c;
      }

      .icon-shopping {
        color: #34bfa3;
      }

      .card-panel-icon-wrapper {
        float: left;
        margin: 14px 0 0 14px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 48px;
      }

      .card-panel-description {
        //float: right;
        font-weight: bold;
        margin: 26px;
        margin-left: 0px;
        text-align: right;
        .card-panel-text {
          line-height: 18px;
          color: rgba(0, 0, 0, 0.45);
          margin-bottom: 12px;
        }

        .card-panel-num {
          font-size: 20px;
        }
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
